<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>

<script>
  function onSubmit(op,shopId){
	   document.getElementById('optioninfo').value=op;
	   document.getElementById('shop_id').value=shopId;

      var form = document.getElementById('userForm');
        form.action="shoplist/"+op;
        form.submit();
      }
  function onSubmitDelete(op,shopId){
	   document.getElementById('optioninfo').value=op;
	   document.getElementById('shop_id').value=shopId;
	   if (false === confirm('削除しますか？') )return;

      var form = document.getElementById('userForm');
        form.action="shoplist/"+op;
        form.submit();
      }
  function onSubmitCsv(op,shop_id){

	   document.getElementById('optioninfo').value=op;
	   document.getElementById('shop_id').value=shop_id;

   var form = document.getElementById('userForm');
       form.action="shoplist/"+op;
       form.submit();
 }
  </script>

</head>

@extends('layouts.admin_common') @section('content')

<div class="breadcrumbs_container">
	{{Breadcrumbs::render('admin.shop_master') }}</div>
<div class="system_tab_line"></div>

<body>
	<div id="outDiv">

		<table class="table table-condensed">
			<tr>
				<td>店舗名</td>
				<td>店舗カナ</td>
				<td>担当者</td>


				<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			</tr>
			<tr>@foreach ($allInfo[0] as $shopInfo)


			<tr>
				<td>{{$shopInfo->shop_name}}</td>
				<td>{{$shopInfo->shop_kana}}</td>
				<td>{{$shopInfo->stuff_name}}</td>

				<td><input type="button" value="修正"
					class="btn btn-primary button_normal"
					onclick="onSubmit('create','{{$shopInfo->shop_id}}')" /><input
					type="button" value="削除" class="btn btn-primary button_normal"
					onclick="onSubmitDelete('delete','{{$shopInfo->shop_id}}')" /></td>
			</tr>
			@endforeach
		</table>

		<form class="form-inline" id="userForm" method="post"
			enctype="multipart/form-data">

			<table border="0" cellspacing="0" style="width: 1300px;">
				<tr>
					<td align="right"><input type="button" value="新規"
						class="pure-button pure-button-primary button_normal"
						onclick="onSubmit('create','')" /></td>

					<td align="right" style="width: 10px;"><label for="sample1"
						class="btn btn-primary button_normal">Csv取込 <input type="file"
							name="csv_file" id="sample1" style="display: none;"
							class="btn btn-primary button_normal"
							onChange="onSubmitCsv('csv','{{$shopInfo->shop_id}}')" />
					</label></td>
				</tr>

			</table>
			<div>@if(isset($success)) {{$success}} @endif</div>
			<div>@if(isset($error)) {{$error}} @endif</div>
			<input type="hidden" name="corp_name"
				value="{{$allInfo[1][0]->corp_name}}"> <input type="hidden"
				name="corp_id" value="{{$allInfo[2][0]}}"> <input type="hidden"
				id="shop_id" name="shop_id"> <input type="hidden" id="optioninfo"
				name="optioninfo"> <input type="hidden" name="_token"
				value="{{csrf_token()}}">
		</form>
	</div>
</body>
</html>
@endsection
